#include<stdio.h>
int main()
{
    int n,m;
    scanf("%d %d",&n,&m);
    int arr[n];
    for(int i=0;i<n;i++)
    {
        scanf("%d",&arr[i]);
    }
   while(m--)
   {
       int x;
       scanf("%d",&x);
       int mid;
       int l=0,r=n-1;
       while(l<r)
       {
           mid=(l+r)/2;
           if(x>arr[mid]){
               mid+=1;
               l=mid;
           }
           else 
               r=mid;
       }
       if(arr[mid]==x)
               printf("%d\n",mid+1);
        else
           printf("-1\n");
   }      
       
   
    return 0;
}
